package com.dean.entity;

import java.util.Arrays;

/**
 * @ClassName DeanImportInfo
 * @Description 数据导入信息实体类
 * @Author dean
 * @Date 2021/11/16 14:26
 */
public class DeanImportInfo {
    /**
     * 导入表名
     */
    private String tableName;
    /**
     * 需要导入的表头字段
     */
    private String [] fields;
    /**
     * 每次提交的次数
     */
    private Integer commitNums;
    /**
     * csv 导入导出分割符
     */
    private String delimiter;
    /**
     * csv 文本限定符
     */
    private Character quote;
    /**
     * 是否去掉字段左右空格
     */
    private Boolean trim;
    /**
     * 跳过前几行 默认一行表头
     */
    private Integer skipHead;
    /**
     * 跳过后几行 默认结尾是不需要跳过的
     */
    private Integer skipTail;

    /**
     * 导入文件路径
     */
    private String filePath;


    /**
     * 数据库连接名
     */
    private String connName;

    private String sheetName;

    public String getSheetName() {
        return sheetName;
    }

    public void setSheetName(String sheetName) {
        this.sheetName = sheetName;
    }


    public String getConnName() {
        return connName;
    }

    public void setConnName(String connName) {
        this.connName = connName;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public Integer getSkipHead() {
        return skipHead==null?1:skipHead;
    }

    public void setSkipHead(Integer skipHead) {
        this.skipHead = skipHead;
    }

    public Integer getSkipTail() {
        return skipTail==null?0:skipTail;
    }

    public void setSkipTail(Integer skipTail) {
        this.skipTail = skipTail;
    }

    /**
     * 文件字符集
     * @return
     */
    private String charSet;

    public String getCharSet() {
        return charSet==null?"UTF-8":charSet;
    }

    public void setCharSet(String charSet) {
        this.charSet = charSet;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String[] getFields() {
        return fields;
    }

    public void setFields(String[] fields) {
        this.fields = fields;
    }

    public Integer getCommitNums() {
        return commitNums;
    }

    public void setCommitNums(Integer commitNums) {
        this.commitNums = commitNums;
    }

    public Character getQuote() {
        return quote==null?'"':quote;
    }

    public Boolean getTrim() {
        return trim==null?true:trim;
    }

    public void setTrim(Boolean trim) {
        // 默认去掉空格
        this.trim = trim;
    }

    public void setQuote(Character quote) {
        this.quote = quote;
    }

    public String getDelimiter() {
        return delimiter;
    }

    public void setDelimiter(String delimiter) {
        this.delimiter = delimiter;
    }

    @Override
    public String toString() {
        return "DeanImportInfo{" +
                "tableName='" + tableName + '\'' +
                ", fields=" + Arrays.toString(fields) +
                ", commitNums=" + commitNums +
                ", delimiter='" + delimiter + '\'' +
                ", quote=" + quote +
                ", trim=" + trim +
                ", skipHead=" + skipHead +
                ", skipTail=" + skipTail +
                ", filePath='" + filePath + '\'' +
                ", connName='" + connName + '\'' +
                ", sheetName='" + sheetName + '\'' +
                ", charSet='" + charSet + '\'' +
                '}';
    }
}
